<template>
  <div class="timeLine">
    <section class="content-part" v-for="(item, index) of lineData" :key="index">
      <div class="content" v-if="index%2===0">
        <img class="time-img" :src="imgUrl[index]" alt="">
        <div class="text">
          <h4 class="time-area">{{item.time}}</h4>
          <h4 class="title">{{item.title}}</h4>
          <ul>
            <li v-for="ele of item.descript" :key="ele">{{ ele }}</li>
          </ul>
        </div>
      </div>
      <div class="content content-right" v-if="index%2===1">
        <img class="time-img-left" :src="imgUrl[index]" alt="">
        <div class="text-left">
          <h4 class="time-area">{{item.time}}</h4>
          <h4 class="title">{{item.title}}</h4>
          <ul>
            <li v-for="ele of item.descript" :key="ele">{{ ele }}</li>
          </ul>
        </div>
      </div>
      <div class="line-part">
        <div class="line"></div>
      </div>
    </section>
    <div class="content">
      <img class="time-img" :src="imgUrl[4]" alt="">
    </div>
  </div>
</template>
<script>
import firstImg from '@/assets/timeLine0.png'
import secondImg from '@/assets/timeLine1.png'
import threeImg from '@/assets/timeLine2.png'
import fourImg from '@/assets/timeLine3.png'
import fiveImg from '@/assets/timeLine4.png'
export default {
  name: 'TimeLine',
  props: {
    lineData: Array,
    direction: {
      type: String,
      default: 'left'
    }
  },
  data () {
    return {
      imgUrl: [
        firstImg,
        secondImg,
        threeImg,
        fourImg,
        fiveImg
      ]
    }
  }
}
</script>
<style lang="scss" scoped>
.timeLine{
  width: 100%;
  background: #fff;
  padding-bottom: 100px;
  .content-part{
    overflow: hidden;
  }
  .content{
    width: 790px;
    height:184px;
    overflow: hidden;
  }
  .content-right{
    float: right;
  }
  .time-img{
      float: right;
  }
  .time-img-left{
    float: left;
  }
  .text,.text-left {
    width: 480px;
    height: 182px;
    h4 {
      line-height: 28px;
      font-size: 16px;
      font-weight: bold;
      margin: 6px 0;
    }
    li {
      font-size: 12px;
      line-height: 22px;
      color: #a2a2a2;
    }
  }
  .text{
    float: right;
    text-align: right;
     margin-right: 40px;
  }
  .text-left{
    float: left;
    text-align: left;
    margin-left: 40px;
  }
  .line-part{
    width: 100%;
  }
  .line {
    width: 700px;
    height: 94px;
    border-right: 2px solid #f1f1f1;
    clear: both;
  }
}
</style>
